package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("fos.txt");

        for(;;) {
            System.out.print("输入你要写的字母串：");
            String str1 = scan.nextLine();
            if("exit".equals(str1)) {
                System.out.println("正在退出");
                break;
            }
            fos.write(str1.getBytes(StandardCharsets.UTF_8));
        }
        fos.close();
    }
}
